package cn.niit.service.impl;

import cn.niit.dao.ScoreDao;
import cn.niit.entity.Attendance;
import cn.niit.entity.Score;
import cn.niit.entity.query.ScoreQuery;
import cn.niit.service.ScoreService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 成绩表(Score)表服务实现类
 *
 * @author makejava
 * @since 2021-11-14 16:07:31
 */
@Service("scoreService")
public class ScoreServiceImpl implements ScoreService {
    @Resource
    private ScoreDao scoreDao;



    @Override
    public PageInfo<Score> queryAll(ScoreQuery scoreQuery) {
        PageHelper.startPage(scoreQuery.getPageNum(), scoreQuery.getPageSize());
        return new PageInfo<Score>(scoreDao.queryAll(scoreQuery));
    }

    @Override
    public PageInfo<Score> queryByStudentCode(ScoreQuery scoreQuery) {
        PageHelper.startPage(scoreQuery.getPageNum(), scoreQuery.getPageSize());
        return new PageInfo<Score>(scoreDao.queryByStudentCode(scoreQuery));
    }

    @Override
    public PageInfo<Score> select(ScoreQuery scoreQuery) {
        PageHelper.startPage(scoreQuery.getPageNum(), scoreQuery.getPageSize());
        return new PageInfo<Score>(scoreDao.select(scoreQuery));
    }

    @Override
    public Score queryScoreById(Integer id) {
        return scoreDao.queryScoreById(id);
    }

    @Override
    public boolean addScore(Score score) {
        return scoreDao.addScore(score) > 0;
    }

    @Override
    public boolean editScore(Score score) {
        int i = scoreDao.editScore(score);
        return i > 0;
    }

    @Override
    public boolean deleteScoreById(Integer id) {
        int i = scoreDao.deleteScoreById(id);
        return i > 0;
    }


}